home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-12-02 | 13.3 KB | 84 lines | [TEXT/SPM ] |
- /*
- IC Switch Glue.c
-
- Code to handle switching between the use of the component and the use of the linked-in
- routines.
-
- I have implemented a small modification to the switch glue. Basically from code the switch
- can be controled to act in a certain manner. For example, the code to call the component can
- be turned off so that all calls made to the switch glue will always be handled by the linked in
- code. In fact, both the component and linked in code can be disabled causing the code to always
- return without doing anything to the prefs whatsoever.
-
- I also modified the routines to return paramErr if a null ICInstance is passed as a parameter.
- */
-
- #include <AppleTalk.h>
- #include <Aliases.h>
-
- // include types and key information
- #include "IC Types.h"
- #include "IC Keys.h"
-
- // include the main header for this file
- #include "IC API.h"
-
- // include the headers for the component and resource routines
- #include "IC Component API.h"
- #include "IC Resource API.h"
-
- // vars enabling/disabling the available code
- static Boolean gICSwitchCanUseComponent=true;
- static Boolean gICSwitchCanUseLinkIn=true;
-
- OSErr ICEnableComponent(void){
- gICSwitchCanUseComponent=true;
- return noErr;
- }
-
- OSErr ICDisableComponent(void){
- gICSwitchCanUseComponent=false;
- return noErr;
- }
-
- OSErr ICEnableLinkedCode(void){
- gICSwitchCanUseLinkIn=true;
- return noErr;
- }
-
- OSErr ICDisableLinkedCode(void){
- gICSwitchCanUseLinkIn=false;
- return noErr;
- }
-
- Boolean ICComponentEnabled(void){
- return gICSwitchCanUseComponent;
- }
-
- Boolean ICLinkedCodeEnabled(void){
- return gICSwitchCanUseLinkIn;
- }
-
- Boolean ICUsingComponent(ICInstance inst){
- ICRRecordPtr rp=(ICRRecordPtr)inst;
-
- // actually an error, but no way to return an error code
- if (inst==(ICInstance)0)
- return false;
-
- if (rp->instance!=(ComponentInstance)0)
- return true;
- return false;
- }
-
- ICError ICStart(ICInstance* inst,OSType creator){
- ICError err;
- ICRRecordPtr instr;
-
- instr=(ICRRecordPtr)NewPtr(sizeof(ICRRecord));
- err=MemError();
-
- if (err!=noErr)
- return err;
-
- if (gICSwitchCanUseCompone